package com.koudai.finance.utils.wxpay;

/**
 * @Description: 微信支付配置
 * @Author: ls
 * @Date: 2020/08/10 10:50
 */

public class WxPayConfig {
    /**
     * 公众账号ID
     */
    public static final String appId = "wx3a825de2d6c887ec";

    /**
     * 商户号
     */
    public static final String mchId = "1518598521";

    /**
     * API密钥
     */
    public static final String apiKey = "msjnx8jggYBXYtTgpDzMi5wPKtGLBq1b";

    /**
     * 微信证书
     * @return
     */
    public static String getCert() {
        String separator = System.getProperty("file.separator");
        return WxPayConfig.getClassPath() + separator + "static" + separator + "cert" + separator + "apiclient_cert.p12";
    }

    /**
     * 获取系统路径
     *
     * @return
     */
    public static String getClassPath() {
        String path = Thread.currentThread().getContextClassLoader().getResource("").toString();
        String temp = path.replaceFirst("file:/", "");
        String separator = System.getProperty("file.separator");
        return temp.replaceAll("/", separator + separator);
    }

}
